﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GERI;
using GERI.MES.Domain.Personnel;
using GERI.MES.Domain.General;
using GERI.MES.Business.PersonManage;


namespace WindowsFormsApplication1
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
            IniDbConnect();
        }

        private void IniDbConnect()
        {
            DbConnectionFatory.Instance.GeneralDbName = "PlatformDB";
            DbConnectionFatory.Instance.ServerName = "202.202.202.13";
            DbConnectionFatory.Instance.UserID = "sa";
            DbConnectionFatory.Instance.Password = "zaq1@WSX";
        }

        private void button1_Click(object sender, EventArgs e)
        {
            PersonManager man = new PersonManager();
            myList<Person> pl = man.GetPersonList();
            foreach (Person p in pl)
            {
                this.textBox1.Text += string.Format("id:{0}，Code:{1},Name:{2}\n\r", p.ID, p.Code, p.Name);
            }
            
            
        }

        private void button2_Click(object sender, EventArgs e)
        {
            PersonManager man = new PersonManager();
            Person p = man.GetPerson(3);
            this.textBox1.Text = p.Authoritys.Count.ToString();
        }


        


    }
}
